/**
 *
 */
package com.angel.dao.generic.comparators;

import java.util.Comparator;

import com.angel.dao.generic.interfaces.FindAllInstancesAction;

/**
 *
 * @author William
 *
 */
public class FindAllInstancesActionPriorityComparator<T extends Object> implements Comparator<FindAllInstancesAction<T>>{

	public int compare(FindAllInstancesAction<T> o1, FindAllInstancesAction<T> o2) {
		int compareResult = 0;
		if(o1 != null && o2 != null){
			if(o1.priorityLevel().intValue() > o2.priorityLevel()){
				compareResult = -1;
			} else if(o1.priorityLevel().intValue() < o2.priorityLevel()){
				compareResult = 1;
			}
		} else {
			if(o1 != null){
				compareResult = -1;
			} else {
				compareResult = 1;
			}
		}
		return compareResult;
	}



}
